package com.qingke.easyjava.exercise.besuper;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Collections;
import java.util.Comparator;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;

public class Load {
	private static BeSuper besuper; 
	public static void loadBeSuper(){
		JAXBContext jx;
			try {
				jx = JAXBContext.newInstance(BeSuper.class);
				besuper = (BeSuper) jx.createUnmarshaller().unmarshal(new FileInputStream("jdbc.properties"));
				Collections.sort(besuper.getQuestions(), new Comparator<Question>(){

					@Override
					public int compare(Question o1, Question o2) {
						boolean isSolved1 = o1.isSolved();
						boolean isSolved2 = o2.isSolved();
						if(isSolved1 == isSolved2){
							
						}
						
						return 0;
					}
					
				});
				
			} catch (JAXBException |FileNotFoundException e) {
				e.printStackTrace();
			}
	}

}
